Skip to content

docs: Replace .runsettings with testconfig.json in code coverage documentation#4691

Merged
thomhurst merged 2 commits intomainfrom
copilot/fix-documentation-code-coverage
Feb 6, 2026
Merged

docs: Replace .runsettings with testconfig.json in code coverage documentation#4691
thomhurst merged 2 commits intomainfrom
copilot/fix-documentation-code-coverage

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

TUnit uses Microsoft.Testing.Platform, not VSTest — .runsettings files are not supported. All code coverage configuration docs incorrectly showed .runsettings XML examples, which produce blank coverage reports.

Changes

  • docs/docs/extensions/extensions.md — Advanced coverage config section
  • docs/docs/migration/{nunit,mstest,xunit}.md — Coverage config + troubleshooting in each migration guide
  • docs/docs/troubleshooting.md — Three coverage troubleshooting sections (missing coverage, exclude tests, include-only production)
  • docs/docs/execution/engine-modes.md — Environment variable configuration example

All .runsettings XML examples replaced with the correct testconfig.json format:

{
  "codeCoverage": {
    "Configuration": {
      "CodeCoverage": {
        "ModulePaths": {
          "Include": [".*\\.dll$"],
          "Exclude": [".*tests\\.dll$"]
        }
      }
    }
  }
}

Also notes the --coverage-settings CLI flag as an alternative for XML coverage config files. Updated documentation links to point to Microsoft's codecoverage configuration docs.

The only remaining .runsettings mentions are in the troubleshooting migration section, where they intentionally describe the old VSTest format being migrated away from.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: Documentation: runsettings is not actually supported</issue_title>
<issue_description>### Description

The documentation for code coverage (under extensions, as well as for individual frameworks e.g. migrating from NUnit) says that code coverage behavior can be customized using a .runsettings file. However, .runsettings files do not appear to be supported by TUnit using Microsoft.Testing.Platform; instead, MTP uses testconfig.json files with basically the same options, although some defaults are different. The documentation should show testconfig.json examples instead.

Expected Behavior

Using a .runsettings file would customize the behavior of the code coverage tool.

Actual Behavior

The code coverage report is always completely blank, with the message "Empty results generated: No binaries were instrumented. Make sure the tests ran, required binaries were loaded, had matching symbol files, and were not excluded through custom settings. For native C++ code coverage you have to link with /PROFILE option enabled. For more information see https://docs.microsoft.com/visualstudio/test/troubleshooting-code-coverage"

Steps to Reproduce

Example .runsettings file:

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
    <DataCollectionRunSettings>
        <DataCollectors>
            <DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
                <Configuration>
                    <CodeCoverage>
                        <Attributes>
                            <Exclude>
                                <Attribute>^System\.Diagnostics\.DebuggerHiddenAttribute$</Attribute>
                                <Attribute>^System\.Diagnostics\.DebuggerNonUserCodeAttribute$</Attribute>
                                <Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute>
                                <Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute>
                            </Exclude>
                        </Attributes>
                    </CodeCoverage>
                </Configuration>
            </DataCollector>
        </DataCollectors>
    </DataCollectionRunSettings>
</RunSettings>

TUnit Version

1.12.139

.NET Version

.NET 10

Operating System

Windows

IDE / Test Runner

Visual Studio

Error Output / Stack Trace

Additional Context

There isn't actually an option to pass a .runsettings file to dotnet test, it only accepts testconfig.json files. The only way to even try to supply a .runsettings file is in Visual Studio, because it doesn't support testconfig.json yet, but this doesn't work for me. Even if there is a way to get it working, it would only be an option in Visual Studio, and everyone not using Visual Studio would still have to use testconfig.json.

IDE-Specific Issue?

  • I've confirmed this issue occurs when running via dotnet test or dotnet run, not just in my IDE</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…erage configuration

Co-authored-by: thomhurst <30480171+thomhurst@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix documentation for code coverage settings docs: Replace .runsettings with testconfig.json in code coverage documentation Feb 6, 2026
Copilot AI requested a review from thomhurst February 6, 2026 15:40
@thomhurst thomhurst marked this pull request as ready for review February 6, 2026 18:16
@thomhurst thomhurst merged commit aa45291 into main Feb 6, 2026
12 of 14 checks passed
@thomhurst thomhurst deleted the copilot/fix-documentation-code-coverage branch February 6, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Documentation: runsettings is not actually supported

2 participants